package com.milkcoffee.designpatterns.singleton;

/**
 * @author zxs
 */
public class InnerClassSingleton {

    private static class InnerClassSingletonHolder{
        private static InnerClassSingleton instance = new InnerClassSingleton();
    }

    private InnerClassSingleton(){
        if (InnerClassSingletonHolder.instance != null){
            throw new RuntimeException("已经初始化");
        }
    }

    public static InnerClassSingleton getInstance(){
        return InnerClassSingletonHolder.instance;
    }
}
